
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="com.wlcorp.forcazamis.sys.permission.PermissionManager" %>
<%@ page import="com.wlcorp.forcazamis.sys.util.SessionValue" %>
<%@ page import="com.wlcorp.forcazamis.domain.system.Staff" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.wlcorp.forcazamis.sys.permission.PermissionGroup" %>
<%@ page import="com.wlcorp.forcazamis.sys.permission.PermissionPage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
	PermissionManager permissionManager = PermissionManager.getInstance();
	Staff staff = SessionValue.getInstance(request).getStaff();
	String[] permission = staff.getPermission();
	if(null == permission){
		permission = new String[]{};
	}
%>
<html>
	<head>
		<title>主页菜单</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link rel="stylesheet" href="./css/maincss.css" type="text/css">
		<style type="text/css">
<!--
body {  background-image: url(./images/menu_bg.gif); background-repeat: no-repeat; background-attachment: fixed}
-->
</style>
	</head>

	<script language=javascript>
<!-- 
 
function select_menu(id) {
	var menu = document.getElementById("menu" + id);
	var pic = document.getElementById("pic" + id);
	if("none" == menu.style.display){
		menu.style.display = "" ;
		pic.src = "./images/main_open.gif" ;
	}else{
		menu.style.display = "none" ;
		pic.src = "./images/main_close.gif" ;
	}
} 
function select_menu_f(id) {
	var menu = document.getElementById("menu_value_f_" + id);
	var pic = document.getElementById("pic_f_" + id);
	if("none" == menu.style.display){
		menu.style.display = "" ;
		pic.src = "./images/main_open.gif" ;
	}else{
		menu.style.display = "none" ;
		pic.src = "./images/main_close.gif" ;
	}
} 

function close_window() {
    if (confirm("确定退出？")) {
        parent.opener = null ;
        parent.close();
    }
}

function open_window(url){
	this.parent.main.location=url;
}


// -->
</script>
	<body leftmargin="5" topmargin="5" background="./images/menu_bg.gif" bgcolor="E5ECF4">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="20">
					<img src="./images/ico_main_system.gif" width="16" height="16">
				</td>
				<td colspan="3">
					<b class="fs12_200">功能菜单</b>
				</td>
			</tr>
		</table>
		<%
			List permissionGroupList = permissionManager.getPermissionGroupList();
			for(Iterator groupIter = permissionGroupList.iterator();groupIter.hasNext();){
				PermissionGroup permissionGroup = (PermissionGroup)groupIter.next();
		%>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" style="DISPLAY: ">
		  <tr style="cursor: hand" onclick="javascript:select_menu_f('<%=permissionGroup.getId()%>')"> 
		    <td width="20" align="center"><img src="./images/main_close.gif" id=pic_f_<%=permissionGroup.getId()%> width="20" height="20"></td>
		    <td width="20" align="center"><img src=".<%=permissionGroup.getImagePath()%>" width="16" height="16"></td>
		    <td  ><b class="fs12_200"><%=permissionGroup.getTitle()%></b></td>
	  	  </tr>
	    </table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="menu_value_f_<%=permissionGroup.getId()%>" style="display:none">
			<%
				List permissionPageList = permissionManager.getPermissionPagesByGroup(permissionGroup.getId());
				for(Iterator pageIter = permissionPageList.iterator();pageIter.hasNext();){
					PermissionPage permissionPage = (PermissionPage)pageIter.next();
					if(!permissionManager.checkPermission(permission,permissionPage.getId())){
						continue;
					}
			%>
			<!-- 子菜单 -->
			<tr style="cursor: hand"> 
			    <td width="20" align="center"><img src="./images/connect_3.gif" width="20" height="20"></td>
			    <td width="20" align="center"><img src="./images/connect_1.gif" id=pic8 width="20" height="20"></td>
			    <td><b class="fs12">&nbsp;<font style="cursor: hand" onclick="open_window('${pageContext.request.contextPath}<%=permissionPage.getAction()%>?method=<%=permissionPage.getMethod()%>')" color="blue" onmousedown="this.color='#990099'" onmouseout="this.color='blue'"><%=permissionPage.getTitle()%></font></b></td>
			  </tr>
			<%}%>
			<!-- 子菜单 -->
		</table>
		<%}%>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="20" align="center">
					<img src="./images/connect_2.gif" width="20" height="20">
				</td>
				<td width="20" align="center">
					<img src="./images/exit.gif" width="16" height="16">
				</td>
				<td style="cursor: hand" onclick="close_window()">
					<b class="fs12_200">退出系统</b>
				</td>
			</tr>
		</table>
	</body>
</html>

